package com.larly.controller;


import com.larly.manager.upload.UploadFile;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.UUID;


@RestController
@RequestMapping("/health")
public class HealthController {

    @Resource
    private UploadFile uploadFile;

    @GetMapping
    public String healthCheck() {
        String message = "OK";
        return message;
    }
    /**
     * 测试上传图片接口
     */
    @PostMapping("/upload")
    public Boolean upload(MultipartFile file) {
        String key = UUID.randomUUID().toString();
        boolean result = uploadFile.uploadFile(file, key);
        return result;
    }

}
